package com.ktr.controller;

import com.ktr.entity.KtrInfoData;
import com.ktr.service.KtrInfoDataService;
import com.bhudy.base.QueryFilter;
import com.sys.utils.RequestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author com.bhudy
 * @Description KtrInfoDataController
 * @Date 2019-10-30 23:09:37
 */
@RestController
public class KtrInfoDataController {

    @Autowired
    private KtrInfoDataService ktrInfoDataService;

    @GetMapping(value = "/api/v1/ktrInfoDatas")
    public Object getAll(){
        QueryFilter queryFilter = new QueryFilter();
        queryFilter.clear();
        return RequestUtils.printMapJson(0, ktrInfoDataService.findList(queryFilter));
    }

    @GetMapping(value = "/api/v1/ktrInfoData")
    public Object get(Long ktrId) {
        return RequestUtils.printMapJson(0, ktrInfoDataService.get(ktrId));
    }

    @PostMapping(value = "/api/v1/ktrInfoData")
    public Object insert(KtrInfoData ktrInfoData){
        return RequestUtils.printMapJson(0, ktrInfoDataService.insert(ktrInfoData));
    }

    @PutMapping(value = "/api/v1/ktrInfoData")
    public Object update(KtrInfoData ktrInfoData){
        return RequestUtils.printMapJson(0, ktrInfoDataService.update(ktrInfoData));
    }

    @DeleteMapping(value = "/api/v1/ktrInfoData")
    public Object delete(Long[] ktrId) {
        return RequestUtils.printMapJson(0, ktrInfoDataService.delete(ktrId));
    }

}
